package com.lxk.concurrency.example.threadLocal;

public class RequestHolder {

	private final static ThreadLocal<Long> requestHolder = new ThreadLocal<>();

	// 内部相当于有个 Map 管理，key 就是线程的 id，value 就是 set 进去的值
	public static void add(Long id) {
		requestHolder.set(id);
	}

	public static Long getId() {
		return requestHolder.get();
	}

	public static void remove() {
		requestHolder.remove();
	}
}
